class Person(object):
    def __init__(self, name, age):
        self.name = name
        self._age = age

    @property
    def age(self):
        return self._age

    @age.setter
    def age(self,newage):
        if newage > 18:
            print("只收未成年人，你超了")
        else:
            self._age = newage

if __name__ == '__main__':
    wwk = Person("wwk", 10)
    print(wwk.age)
    wwk.age = 1000
    print(wwk.age)